home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.cs.arizona.edu
/
ftp.cs.arizona.edu.tar
/
ftp.cs.arizona.edu
/
icon
/
newsgrp
/
group97a.txt
/
000094_icon-group-sender _Sun Mar 23 07:14:34 1997.msg
< prev
next >
Wrap
Internet Message Format
|
2000-09-20
|
2KB
Received: by cheltenham.cs.arizona.edu; Sun, 23 Mar 1997 18:40:39 MST
Date: Sun, 23 Mar 1997 07:14:34 -0600 (CST)
From: "Chris D. Tenaglia" <cdt@post.its.mcw.edu>
To: Stuart Robinson <Stuart.Robinson@anu.edu.au>
Cc: icon-group@cs.arizona.edu
Subject: Re: Problem with Program
In-Reply-To: <33338AEF.420@anu.edu.au>
Message-Id: <Pine.ULT.3.90.970323070458.2675A-100000@post.its.mcw.edu>
Mime-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Errors-To: icon-group-errors@cs.arizona.edu
Status: RO
Content-Length: 1427
I assume that code snippit was pseudocode? If not, there is
also the need to put multiple expressions of a clause between
curly braces {
presentline := "quote"
write( "\t" || line );
}
String scanning has it uses, but it makes the problem harder in
this case. There are many ways to skin this cat.
procedure main()
while line := read() do
{
line := if find("{Q",line) then "\t" || line || "\n\t" else line
writes(line)
}
end
Chris Tenaglia (system manager) | cdt@post.its.mcw.edu
Medical College of Wisconsin |
8701 W. Watertown Plank Rd. | Ce que vous voyez est
Milwaukee, WI 53226 (414)456-8765 | ce que vous obtenez !
On Sat, 22 Mar 1997, Stuart Robinson wrote:
> This short little program is meant to read a line and write either (1)
> a tab followed by the line or (2) simply the line. It should do (1)
> if the line either contains "{Q" or follows a line with "{Q";
> otherwise, it should do (2).
>
>
> procedure main()
>
> lastline := ""
>
> while line := read() do
> {
> line ?
> {
> if find( "{Q" )
> then
> presentline := "quote"
> write( "\t" || line );
>
> else
> if lastline == "quote"
> then
> write( "\t" || line )
> presentline := "notquote";
>
> else other
> write( line )
> presentline := "notquote"
> }
> }
>
> lastline := presentline
>
> end
>